import React from 'react';
import Toc from 'react-toc';

import styles from './index.less';

import IconFont from '@/components/iconFont';

export default (props: { source: string }) => {
  return (
    <div className={styles.card}>
      <div className={styles.content}>
        <div className={styles.header}>
          <IconFont use={'ngcanmuluchaolu-xianxing'} />
          <span>目录</span>
        </div>
        <div className={styles.toc}>
          <Toc markdownText={props.source} />
        </div>
      </div>
    </div>
  );
};
